<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="en,default">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />



  <meta name="google-site-verification" content="neREdgy0YHiEBAV4iCGPb8V3dj0F8dDMQ2OYRpRQKyo" />














  
  
  <link href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/vendors/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.0.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="CocoaPods,Xcode8," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.0.2" />






<meta property="og:type" content="article">
<meta property="og:title" content="CocoaPods 使用经验教程 For Xcode 8">
<meta property="og:url" content="https://didee.cn/2015/10/17/CocoaPods-Xcode8/index.html">
<meta property="og:site_name" content="Dee's Blog">
<meta property="og:image" content="https://didee.cn/images/batch_Snip20161013_3.jpg">
<meta property="og:image" content="https://didee.cn/images/batch_Snip20161013_6-1.jpg">
<meta property="og:image" content="https://didee.cn/images/batch_Snip20161013_9.jpg">
<meta property="og:image" content="https://didee.cn/images/batch_Snip20161013_10.jpg">
<meta property="og:image" content="https://didee.cn/images/batch_Snip20161013_11.jpg">
<meta property="og:image" content="https://didee.cn/images/batch_Snip20161013_12.jpg">
<meta property="og:image" content="https://didee.cn/images/batch_Snip20161013_13.jpg">
<meta property="og:image" content="https://didee.cn/images/Snip%201.png">
<meta property="og:updated_time" content="2017-02-10T03:25:23.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="CocoaPods 使用经验教程 For Xcode 8">
<meta name="twitter:image" content="https://didee.cn/images/batch_Snip20161013_3.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '5.0.2',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn"}},
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://didee.cn/2015/10/17/CocoaPods-Xcode8/"/>





  <title>CocoaPods 使用经验教程 For Xcode 8 | Dee's Blog</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="en">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Dee's Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
            
            Archives
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
            
            Categories
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
            
            About
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://didee.cn/2015/10/17/CocoaPods-Xcode8/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Dee">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Dee's Blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">CocoaPods 使用经验教程 For Xcode 8</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2015-10-17T19:54:34+08:00">
                2015-10-17
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">In</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Xcode/" itemprop="url" rel="index">
                    <span itemprop="name">Xcode</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p><img src="/images/batch_Snip20161013_3.jpg" alt="batch_Snip20161013_3-w1365"></p>
<a id="more"></a>
<h2 id="安装-CocoaPods"><a href="#安装-CocoaPods" class="headerlink" title="安装 CocoaPods"></a>安装 CocoaPods</h2><p>请参考 <a href="http://www.cocoachina.com/ios/20160922/17622.html" target="_blank" rel="external">CocoaPods的安装以及遇到的坑</a></p>
<h2 id="创建-Podfile"><a href="#创建-Podfile" class="headerlink" title="创建 Podfile"></a>创建 Podfile</h2><p>打开终端 , <code>cd+拖拽</code>切换到 项目目录</p>
<p><img src="/images/batch_Snip20161013_6-1.jpg" alt="batch_Snip20161013_6"><br><!-- more --></p>
<p>输入:<code>vim Podfile</code></p>
<p>输入配置信息并保存</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">platform :ios,&apos;8.0&apos;</div><div class="line">        target &apos;1011-PodTest&apos; do</div><div class="line"></div><div class="line">        pod &apos;Masonry&apos;, &apos;~&gt; 1.0.2&apos;</div><div class="line"></div><div class="line">        end</div></pre></td></tr></table></figure>
<h2 id="配置说明"><a href="#配置说明" class="headerlink" title="配置说明"></a>配置说明</h2><p><code>ios,&#39;8.0&#39;</code>  必填</p>
<p><code>target &#39;1011-PodTest&#39;</code>  //填写target名称</p>
<p><code>do~end</code>  -  导入的框架</p>
<h2 id="检索开源框架"><a href="#检索开源框架" class="headerlink" title="检索开源框架"></a>检索开源框架</h2><p>如 <code>pod search mas</code></p>
<p><img src="/images/batch_Snip20161013_9.jpg" alt="batch_Snip20161013_9-w724"></p>
<p>复制标注部分,粘贴到Podfile</p>
<p><img src="/images/batch_Snip20161013_10.jpg" alt="batch_Snip20161013_10-w726"></p>
<h2 id="安装和卸载"><a href="#安装和卸载" class="headerlink" title="安装和卸载"></a>安装和卸载</h2><p><strong>安装:</strong></p>
<p><code>pod install</code></p>
<p><img src="/images/batch_Snip20161013_11.jpg" alt="batch_Snip20161013_11-w728"></p>
<p><strong>卸载:</strong></p>
<p>编辑Podfile,删除<code>pod &#39;MASAttributes&#39;, &#39;~&gt; 1.0.2&#39;</code>行</p>
<p>输入:<code>pod update</code></p>
<p>会根据Podfile升级或卸载</p>
<p><img src="/images/batch_Snip20161013_12.jpg" alt="batch_Snip20161013_12-w721"></p>
<h2 id="使用xcworkspace打开项目"><a href="#使用xcworkspace打开项目" class="headerlink" title="使用xcworkspace打开项目"></a>使用xcworkspace打开项目</h2><p><img src="/images/batch_Snip20161013_13.jpg" width="191"></p>
<p>此时可以<code>#import</code>了</p>
<h2 id="修改-User-Header-Search-Paths"><a href="#修改-User-Header-Search-Paths" class="headerlink" title="修改 User Header Search Paths"></a>修改 <code>User Header Search Paths</code></h2><p>找到<code>User Header Search Paths</code><br>添加 <code>${SRCROOT}</code>并设置为 <code>recursive</code></p>
<p><img src="/images/Snip%201.png" alt="Snip 1"></p>
<h2 id="常用指令"><a href="#常用指令" class="headerlink" title="常用指令"></a>常用指令</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">$ sudo gem install cocoapods</div><div class="line">$ pod search 查找的库</div><div class="line">$ vim Podfile</div><div class="line">$ pod install</div><div class="line">$ pod update</div></pre></td></tr></table></figure>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/CocoaPods/" rel="tag"># CocoaPods</a>
          
            <a href="/tags/Xcode8/" rel="tag"># Xcode8</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2015/10/16/bai-du-yun-mac/" rel="next" title="百度云 MAC 不限速 下载 插件 + GUI">
                <i class="fa fa-chevron-left"></i> 百度云 MAC 不限速 下载 插件 + GUI
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2015/10/17/shadowsocks-client/" rel="prev" title="Shadowsocks 客户端 多平台 SSR NG R8 多版本">
                Shadowsocks 客户端 多平台 SSR NG R8 多版本 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            Overview
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          
            <img class="site-author-image" itemprop="image"
              src="/images/avatar.jpg"
              alt="Dee" />
          
            <p class="site-author-name" itemprop="name">Dee</p>
            <p class="site-description motion-element" itemprop="description">AN Ordinary Developer , Geek</p>
        </div>

        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
            
              <a href="/archives/">
            
                <span class="site-state-item-count">13</span>
                <span class="site-state-item-name">posts</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">7</span>
                <span class="site-state-item-name">categories</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">21</span>
                <span class="site-state-item-name">tags</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/didez" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-globe"></i>GitHub</a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://wpa.qq.com/msgrd?v=3&uin=305451372&site=qq&menu=yes" target="_blank" title="QQ">
                  
                    <i class="fa fa-fw fa-globe"></i>QQ</a>
              </span>
            
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-inline">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              Links
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="https://www.upyun.com" title="UPYUN" target="_blank">UPYUN</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.v2ex.com/?r=qq30545" title="V2EX" target="_blank">V2EX</a>
                </li>
              
            </ul>
          </div>
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#安装-CocoaPods"><span class="nav-number">1.</span> <span class="nav-text">安装 CocoaPods</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#创建-Podfile"><span class="nav-number">2.</span> <span class="nav-text">创建 Podfile</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#配置说明"><span class="nav-number">3.</span> <span class="nav-text">配置说明</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#检索开源框架"><span class="nav-number">4.</span> <span class="nav-text">检索开源框架</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#安装和卸载"><span class="nav-number">5.</span> <span class="nav-text">安装和卸载</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用xcworkspace打开项目"><span class="nav-number">6.</span> <span class="nav-text">使用xcworkspace打开项目</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#修改-User-Header-Search-Paths"><span class="nav-number">7.</span> <span class="nav-text">修改 User Header Search Paths</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#常用指令"><span class="nav-number">8.</span> <span class="nav-text">常用指令</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2013 &mdash; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Dee</span>

  
</div>


  <div class="powered-by">Powered by <a class="theme-link" href="https://hexo.io">Hexo</a></div>

  <span class="post-meta-divider">|</span>

  <div class="theme-info">Theme &mdash; <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> v5.0.2</div>


        




  <script type="text/javascript">
    (function() {
      var hm = document.createElement("script");
      hm.src = "//tajs.qq.com/stats?sId=59029013";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/vendors/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/vendors/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/vendors/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.0.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.0.2"></script>



  
  

  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.0.2"></script>


  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.0.2"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.0.2"></script>



  


  




	





  





  








  





  

  

  

  

  

  

</body>
</html>
